package com.xjrsoft.common.querys;

import com.baomidou.mybatisplus.generator.config.querys.KingbaseESQuery;

public class MyKingBaseQuery extends KingbaseESQuery {

    @Override
    public String tableFieldsSql() {
        return "select A.attname as name, t.typname as \"type\", " +
                "substring(format_type(a.atttypid, a.atttypmod) from '[0-9].*[0-9]') as \"MAX_LENGTH\", " +
                "col_description (A.attrelid, A.attnum) as comment, (case when ( select count (*) from pg_constraint " +
                "as PC where A.attnum = PC.conkey[1] and PC.contype = 'p') > 0 then 'PRI' else '' end) as key from pg_class " +
                "as C, pg_type t, pg_attribute as A where A.attrelid = '%s.%s'::regclass and A.attrelid = " +
                "C.oid and A.attnum> 0 and a.atttypid = t.oid and not A.attisdropped order by A.attnum";
    }
}
